package com.cxz.study.ddd_project.application.util;

import com.cxz.study.ddd_2082_project.api.v1.dto.base.WhSerialNoRecordDTO;
import com.cxz.study.ddd_2082_project.api.v1.param.base.WhSerialNoRecordParam;
import com.cxz.study.ddd_project.domain.biz.model.base.WhSerialNoRecordBO;

import java.util.List;

/**
 * @className: BeanConvert
 * @author: ocxz1
 * @date: 2024/12/29 下午10:01
 * @Version: 1.0
 * @description: ddd_project1
 */
public class BeanConvert {

    public static WhSerialNoRecordBO convertToWhSerialNoRecordBO(WhSerialNoRecordParam item) {
        if (item == null) {
            return null;
        }
        WhSerialNoRecordBO result = new WhSerialNoRecordBO();
        result.setId(item.getId());
        result.setOrderId(item.getOrderId());
        result.setStationNo(item.getStationNo());
        result.setSourceNo(item.getSourceNo());
        result.setSourceId(item.getSourceId());
        result.setSourceType(item.getSourceType());
        return result;
    }

    public static WhSerialNoRecordDTO convertToWhSerialNoRecordDTO(WhSerialNoRecordBO item) {
        if (item == null) {
            return null;
        }
        WhSerialNoRecordDTO result = new WhSerialNoRecordDTO();
        result.setId(item.getId());
        result.setOrderId(item.getOrderId());
        result.setStationNo(item.getStationNo());
        result.setSourceNo(item.getSourceNo());
        result.setSourceId(item.getSourceId());
        result.setSourceType(item.getSourceType());
        return result;
    }

    public static List<WhSerialNoRecordDTO> convertToWhSerialNoRecordDTOList(List<WhSerialNoRecordBO> item) {
        if (item == null) {
            return null;
        }
        return item.stream().map(BeanConvert::convertToWhSerialNoRecordDTO).toList();
    }
}
